package com.zr.controller.car

import com.alibaba.fastjson.JSON
import com.github.pagehelper.PageInfo
import com.zr.service.car.Impl.WorkServerImpl
import com.zr.util.Result
import com.zr.vo.CarWorkSelectBean
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/car/Work")
class WorkController {

    @Autowired
    val workServer: WorkServerImpl?=null

    @RequestMapping("/listByCarWorkSelectBean")
    fun listByCarWorkSelectBean(@RequestBody workBean:CarWorkSelectBean):String{
        val selectResult=workServer?.listByCarWorkSelectBean(workBean)
        val pageInfo=PageInfo<CarWorkSelectBean>(selectResult)
        return JSON.toJSONString(Result(true,"查询成功",pageInfo))
    }
    @RequestMapping("/fitCar")
    fun fitCar(@RequestBody workBean:CarWorkSelectBean):String{
        workServer?.fitCar(workBean)
        return JSON.toJSONString(Result(true,"整备成功",null))
    }
    @RequestMapping("/outCar")
    fun outCar(@RequestBody workBean:CarWorkSelectBean):String{
        workServer?.outCar(workBean)
        return JSON.toJSONString(Result(true,"出车成功",null))
    }
    @RequestMapping("/inCar")
    fun inCar(@RequestBody workBean:CarWorkSelectBean):String{
        workServer?.inCar(workBean)
        return JSON.toJSONString(Result(true,"回车成功",null))
    }
}